Repository navigation
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…Message (#7873) The collab socket is a trust boundary, but handleMessage shape-trusted the UPDATE and CURSOR families: a malformed UPDATE threw inside the step-apply try and was misclassified as desync (close 4001 + reconnect churn), and a malformed CURSOR was stored verbatim in plugin state, feeding NaN positions into decoration/coords code. - UPDATE: drop the frame (log + return, session intact) when steps is not an array, clientIDs is not an array, their lengths differ, or a step fails Step.fromJSON parsing. Step parsing now happens in its own try before the apply try, so only genuine apply failures of well-shaped steps take the existing reconnect path. - CURSOR: drop when clientID is not a string/number, head/anchor are not finite numbers, or name is present and not a string/null. idleSecs is advisory: ignored unless a finite number. - CURSOR_REMOVE: drop when clientID is not a string/number. Seven regression tests in collab.test.ts cover each malformed frame (dropped with editor/session intact — no close, no new socket, no cursor stored) and that a following valid frame still applies. The prose in #7873's probe (malformed UPDATE teardown, phantom cursor) is now pinned as fixtures. collab.test.ts: 31/31 pass. Full web suite: 718 passed, 1 failed — search-panel role=search accessibility, failing identically on pristine main (pre-existing, unrelated). Typecheck clean.
1616580 to
427f75c
Compare
|
Agent note — task 17221 done: already landed, closing PR #8507 (lane any-c) This PR's change is already on main as commit cad4e14 — "fix(id/web): validate UPDATE and CURSOR frame fields in collab handleMessage (#7873)", the same subject as this PR — and issue #7873 was CLOSED at 2026-11-11T10:58:02Z. Verified fresh 2026-11-14 against current main:
Closing as already-landed/superseded per task 17221 acceptance. No Codex findings on this PR; no hard-stop labels. The head branch is left in place (not deleted). |
Closes #7873.
handleMessageinpkgs/id/web/src/collab.tsnow validates the UPDATE and CURSOR frame families at the boundary, like the INIT hardening (#2824) already did:stepsis not an array,clientIDsis not an array, their lengths differ, or any step failsStep.fromJSON. Step parsing moved into its owntryahead of the applytry, so the reconnect path is reserved for genuine apply/desync failures of well-shaped steps — previously a shape error threw inside the apply block and tore the session down withclose(4001)+ reconnect.clientIDis not a string/number,head/anchorare not finite numbers, ornameis present and not a string/null.idleSecsis ignored unless a finite number. Previously these values were cast and stored verbatim in the cursor plugin state (the id(web/collab): UPDATE and CURSOR frame fields shape-trusted — a malformed UPDATE tears the session down (close 4001 + reconnect) instead of being dropped, and a malformed CURSOR is stored verbatim as a phantom cursor #7873 probe's phantom cursor withhead=[object Object], feedingNaNinto decoration math).clientIDis not a string/number.Tests (7 new in
collab.test.ts, in the existing FakeWebSocket harness style): each malformed frame from the issue's probe set is dropped with the editor/session intact (socket stays open, no reconnect socket after timers advance, no cursor stored), a following valid frame still applies, and well-formed CURSOR/CURSOR_REMOVE controls keep working.collab.test.ts: 31/31 passpkgs/id/webvitest suite: 718 passed / 1 failed / 9 skipped — the one failure (search-panelrole=search accessibility) fails identically on pristine main and is unrelated to this changebun run typecheck: cleanOut of scope per the issue family split: server-side step validation (#1618), INIT mode (#7859), AUTH_OK/NEW_VERSION fields (#7854).
🤖 agent-note:v1 — queue task 14189 (lane code-g).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.